//
//  ASTabBarController.h
//
//  Created by apple on 14-9-16.
//  Copyright (c) 2014年. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ASTabBar.h"
#import "ASTabBarItem.h"
#import "UIViewController+ASTabBarItem.h"

typedef enum {
    ASTabBarControllerAnimationNone = 0,
    ASTabBarControllerAnimationFade,
    ASTabBarControllerAnimationCurl,
    ASTabBarControllerAnimationMove,
    ASTabBarControllerAnimationMoveAndScale
}ASTabBarControllerAnimation;

@protocol ASTabBarControllerDelegate;

@interface ASTabBarController : UIViewController

/** An array of the view controllers displayed by the tab bar */
@property (nonatomic, copy) NSArray *viewControllers;
/** The index of the view controller associated with the currently selected tab item. */
@property (nonatomic, assign) NSUInteger selectedIndex;
/** The view controller associated with the currently selected tab item. */
@property (nonatomic, weak) UIViewController *selectedViewController;

/** The tab bar controller’s delegate object. */
@property (nonatomic, weak) id<ASTabBarControllerDelegate> delegate;

/** The tableView used to display all tab bar elements */
@property (nonatomic, strong, readonly) ASTabBar *tabBar;
/** The postion of the tabBar on screen (top/left/bottom/right) */
@property (nonatomic, assign) ASTabBarPosition tabBarPosition;

/** The animation used when changing selected tabBarItem, default: none */
@property (nonatomic, assign) ASTabBarControllerAnimation animation;
/** The duration of the used animation, only taken into account when animation is different from none */
@property (nonatomic, assign) NSTimeInterval animationDuration;

@property (nonatomic, assign) BOOL tabBarHidden;


/** The designated initializer. */
- (id)initWithDelegate:(id<ASTabBarControllerDelegate>)delegate;

- (void)setTabBarHidden:(BOOL)tabBarHidden animated:(BOOL)animated;
@end

@protocol RCSTabBarControllerDelegate <NSObject>

@required

/** Asks the delegate for the size of the given item */
- (CGSize)tabBarController:(ASTabBarController *)tabBarController
sizeOfItemForViewController:(UIViewController *)viewController
                   atIndex:(NSUInteger)index
                  position:(ASTabBarPosition)position;

@optional

/** Asks the delegate whether the specified view controller should be made active. */
- (BOOL)tabBarController:(ASTabBarController *)tabBarController
shouldSelectViewController:(UIViewController *)viewController
                 atIndex:(NSUInteger)index;

/** Tells the delegate that the user selected an item in the tab bar. */
- (void)tabBarController:(ASTabBarController *)tabBarController
 didSelectViewController:(UIViewController *)viewController
                 atIndex:(NSUInteger)index;
@end
